import request from "@/api/request.js";

export function getByChannel(params) {
  return request({
    url: "/api/video/getByChannel",
    method: 'get',
    data: params,
  })
}


export function getById(id, userId) {
  const url = userId == null ? "/api/video/getById/" + id : "/api/video/getById/" + id + "?userId=" + userId;
  return request({
    url,
    method: 'get',
  })
}


export function getRandomVideo(size) {
  return request({
    url: "/api/video/getRandomVideo/" + size,
    method: 'get',
  })
}

export function getAuthorInfo(authorId) {
  return request({
    url: "/api/user/getAuthorInfo/" + authorId,
    method: 'get',
  })
}

export function getVideoList(params) {
  return request({
    url: "/api/video/getByUserId/" + params,
    method: 'get'
  })
}

export function uploadSuccessCallback(params) {
  return request({
    url: "/api/video/uploadSuccessCallback",
    method: 'post',
    data: params
  })
}

export function getByKey(key) {
  return request({
    url: "/api/video/getByKey?key=" + key + "&no=1&size=10",
    method: 'get'
  })
}
